<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>管理后台</title>
    <!-- Tell the browser to be responsive to screen width -->
     <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.4 -->
    <link href="/public/admin/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <!-- FontAwesome 4.3.0 -->
    <link href="/public/admin/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <!-- Ionicons 2.0.0 -->
    <link href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css" />
    <!-- Theme style -->
    <!-- AdminLTE Skins. Choose a skin from the css/skins
        folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/css/bootstrap-select.min.css">
    <!-- Bootstrap 3.3.4 -->
    <link href="/public/admin/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="/public/admin/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/public/admin/css/animate.css" rel="stylesheet">
    <link href="/public/admin/css/ratuo.css" rel="stylesheet">
    <link href="/public/admin/css/style.css?v=4.0.0" rel="stylesheet">
    <!-- jQuery 2.1.4 -->
    <script src="/public/admin/js/jQuery-2.1.4.min.js"></script>
    <script src="/public/admin/js/common.js"></script>
    <script src="/public/admin/js/myFormValidate.js"></script>
    <script src="/public/admin/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="/public/admin/js/plugins/layer/layer.min.js"></script><!-- 弹窗js 参考文档 http://layer.layui.com/-->
    <script src="/public/admin/js/myAjax.js"></script>
    <script src="/public/admin/js/jquery.validate.js"></script>
    <link href="/favicon.ico" type="image/x-icon" rel="shortcut icon" />

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content">
	<div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>管理员列表</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="box">
                                <div class="box-header">
                                    <div class="panel-body">
                                        <a href="javascript:void(0);" onclick="openLayer('{:url("Admin/admin_info")}','添加管理员')" class="btn btn-primary"><i class="fa fa-plus"></i>添加管理员</a>
                                        <a onclick="window.location.href=location.href;" href="javascript:;" class="btn btn-primary pull-right"><i class="glyphicon glyphicon-refresh"></i>刷新</a>
                                    </div>                  
                                </div>
                                <div class="box-body">
                                    <div class="row">
                                        <div class="col-sm-12">
                                        	<table id="list-table" class="table table-bordered">
												<thead>
								                   	<tr role="row">
									                   	<th>ID</th>
									                   	<th>用户名</th>
									                   	<th>所属角色</th>
									                   	<th>加入时间</th>
									                   	<th>状态</th>
									                   	<th>操作</th>
								                   	</tr>
						                 		</thead>
						                 		<tbody>
						                 		{foreach name="data" item="vo" key="k"}
                                                    <tr role="row">
                                                        <td>{$vo.admin_id}</td>
                                                        <td>{$vo.user_name}</td>
                                                        <td>{$vo.title}</td>
                                                        <td>{$vo.add_time|date='Y-m-d'}</td>
                                                        <td>{$vo.status}</td>
                                                        <td>
                                                            <a class="btn btn-primary" href="javascript:void(0);" title="修改" onclick="openLayer('{:url('Admin/admin_info',array('admin_id'=>$vo['admin_id']))}','编辑管理员')"><i class="fa fa-pencil"></i></a>
                                                            <if condition="$vo['admin_id'] gt 1">
                                                            <a class="btn btn-danger" href="javascript:void(0);" title="删除" data-url="{:url('Admin/adminHandle',array('admin_id'=>$vo['admin_id'], 'delete'=>1))}"  onclick="del('{$vo.admin_id}')"><i class="fa fa-trash-o"></i></a>
                                                            </if>
                                                        </td>
                                                    </tr>
								                {/foreach}
						                 		</tbody>
                                        	</table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>
<input id="handle_status" value="" hidden="hidden">
<script>
    function openLayer(url,name){
        parent.layer.open({
            type: 2,
            title: name,
            shade: 0.5,
            shadeClose : false,
            maxmin: true, //开启最大化最小化按钮
            area: ['70%', '80%'],
            content: url,
            end : function(){
                var handle_status = $("#handle_status").val();
                if(handle_status == '1'){
                    window.location.href = location.href;
                }
            }
        });
    }

    function del(id) {
        parent.layer.confirm('确定要删除?', function(){
            parent.layer.closeAll('dialog');
            $.ajax({
                url:"/index.php/Admin/Admin/adminHandle/delete/1/admin_id/"+id,
                success: function(v){
                    var v =  eval('('+v+')');
                    parent.layer.msg(v.msg, {icon: 1,time: 1000});
                    if(v.hasOwnProperty('status') && (v.status == 1))
                        window.location.href = location.href;
                }
            });
            return false;
        });
    }
</script>


</body>
</html>